# coding: utf-8
from sqlalchemy import BigInteger, Column, Float, Integer, MetaData, String, Table, UniqueConstraint, text
from sqlalchemy.dialects.postgresql import TIMESTAMP

metadata = MetaData()


account_third_part = Table(
    'account_third_part', metadata,
    Column('id', BigInteger, nullable=False, server_default=text("nextval('account_third_part_id_seq'::regclass)")),
    Column('user_id', BigInteger, nullable=False),
    Column('category', Integer, nullable=False, server_default=text("0")),
    Column('open_id', String(100), nullable=False),
    Column('union_id', String(100)),
    Column('nick_name', String(100)),
    Column('spec_param', String(200)),
    Column('create_time', TIMESTAMP(True, 6), server_default=text("CURRENT_TIMESTAMP")),
    Column('update_time', TIMESTAMP(True, 6)),
    UniqueConstraint('category', 'open_id')
)


real_auth = Table(
    'real_auth', metadata,
    Column('user_id', BigInteger, nullable=False),
    Column('id_no', String(20), nullable=False),
    Column('name', String(50), nullable=False),
    Column('auth_req_id', String(50)),
    Column('auth_time', TIMESTAMP(precision=6)),
    Column('create_time', TIMESTAMP(precision=6), nullable=False, server_default=text("CURRENT_TIMESTAMP"))
)



